import QtQuick 2.0
import org.qtproject.znews_qt 1.0
import QtQuick.Controls 1.1
import "../common"
import "../delegate"

MainBasePage {


    id: idArticleContent

    m_header.title: "Nội dung ..."
    m_header.showBack: true;
    m_header.onBackClicked: {
        console.log("m_header.onBackClicked: ");
        previousPage();
    }

    visible: false

    property bool visibleContentWaiting: !ApplicationInfo.updateContentSuccess
    property bool visibleContentData: ApplicationInfo.updateContentSuccess


    signal displayImage(string linkImage);

    onDisplayImage: {
        idArticleContent.pushImage(linkImage);
    }

    ContentWaitingScreen {
        id: id_contentWaitingScreen
        width: parent.width;
        height: parent.height;

        visible: visibleContentWaiting
    }

    ScrollBar {
        scrollArea: id_listViewContent;
        height: id_listViewContent.height;
        width: 8
        anchors.right: id_listViewContent.right
        y: m_header.height

        visible: visibleContentData
    }


    ListView {
        id: id_listViewContent
        width: parent.width
        height: parent.height - m_header.height
        y: m_header.height

        visible: visibleContentData

        delegate: ContentRow  { }

        model: ApplicationInfo.getContentModel()

        header: ContentHeader {}

        footer: ContentFooter {}

    }


    Stack.onStatusChanged: {

        m_isLocked = !(Stack.status === Stack.Active)
        console.info("Stack onStatusChanged " , m_isLocked)

    }


}
